/*
 * window.cpp
 *
 *  Created on: 2021年3月23日
 *      Author: root
 */
#include <gui/window.h>

using namespace myos;
using namespace myos::common;
using namespace myos::gui;
using namespace myos::drivers;

Window::Window(Widget* parent,int32_t x,int32_t y,int32_t w,int32_t h,
		int8_t r,int8_t g,int8_t b)
:CompositeWidget(parent,x,y,w,h,r,g,b)
{
	Dragging=false;
}
Window::~Window(){

}
void Window::OnMouseDown(int32_t x,int32_t y,uint8_t button){

	Dragging=button=1;
	CompositeWidget::OnMouseDown(x, y, button);
}
void Window::OnMouseUP(int32_t x,int32_t y,uint8_t button){
	Dragging=false;
	CompositeWidget::OnMouseUP(x, y, button);
}
void Window::OnMouseMove(int32_t oldx,int32_t oldy,int32_t newx,int32_t newy){
	if(Dragging){
		this->x += newx-oldx;
		this->y += newy-oldy;
	}
	CompositeWidget::OnMouseMove(oldx, oldy, newx,newy);
}



